<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数据可视化平台</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.8/dist/chart.umd.min.js"></script>
  
  <!-- 简化Tailwind配置 -->
  <script>
    tailwind.config = {
      theme: {
        extend: {
          colors: {
            primary: '#165DFF',
          },
        }
      }
    }
  </script>
  
  <style type="text/tailwindcss">
    @layer utilities {
      .transition-simple {
        transition: all 0.3s ease;
      }
    }
  </style>
</head>

<body class="bg-gray-50 min-h-screen">
  <!-- 登录页面 -->
  <div id="login-page" class="min-h-screen flex items-center justify-center p-4">
    <div class="w-full max-w-4xl grid md:grid-cols-2 gap-6">
      <!-- 左侧简化区域 -->
      <div class="hidden md:block bg-primary text-white p-8 rounded-xl">
        <h1 class="text-2xl md:text-3xl font-bold mb-4">数据可视化平台</h1>
        <p class="mb-6">探索数据价值，高效分析决策</p >
        <div class="space-y-3">
          <div class="flex items-center gap-2">
            <i class="fa fa-line-chart"></i>
            <span>直观数据展示</span>
          </div>
          <div class="flex items-center gap-2">
            <i class="fa fa-shield"></i>
            <span>安全登录验证</span>
          </div>
        </div>
      </div>
      
      <!-- 右侧登录表单（简化） -->
      <div class="bg-white rounded-xl shadow p-6 md:p-8">
        <h2 class="text-2xl font-bold mb-6 text-center">用户登录</h2>
        <form id="login-form" class="space-y-4">
          <div>
            <label class="block text-sm text-gray-600 mb-1">账号</label>
            <div class="relative">
              <i class="fa fa-user absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
              <input type="text" id="username" 
                class="w-full pl-10 py-2 border border-gray-300 rounded-lg focus:ring-1 focus:ring-primary focus:border-primary outline-none"
                placeholder="请输入账号" required>
            </div>
          </div>
          
          <div>
            <label class="block text-sm text-gray-600 mb-1">密码</label>
            <div class="relative">
              <i class="fa fa-lock absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
              <input type="password" id="password" 
                class="w-full pl-10 py-2 border border-gray-300 rounded-lg focus:ring-1 focus:ring-primary focus:border-primary outline-none"
                placeholder="请输入密码" required>
            </div>
          </div>
          
          <button type="submit" 
            class="w-full bg-primary hover:bg-primary/90 text-white py-2 rounded-lg transition-simple">
            登录 <i class="fa fa-arrow-right ml-1"></i>
          </button>
          
          <p class="text-xs text-gray-500 text-center mt-4">
            测试账号: admin | 密码: 123456
          </p >
        </form>
      </div>
    </div>
  </div>

  <!-- 主界面（简化） -->
  <div id="main-page" class="hidden">
    <!-- 顶部导航 -->
    <header class="bg-white shadow-sm sticky top-0 z-10">
      <div class="container mx-auto px-4 py-3 flex justify-between items-center">
        <div class="flex items-center gap-2">
          <i class="fa fa-bar-chart text-primary text-xl"></i>
          <h1 class="font-bold">数据可视化平台</h1>
        </div>
        <button id="logout-btn" class="text-gray-600 hover:text-primary transition-simple">
          <i class="fa fa-sign-out mr-1"></i> 退出登录
        </button>
      </div>
    </header>
    
    <!-- 主内容 -->
    <main class="container mx-auto px-4 py-6">
      <h2 class="text-xl font-bold mb-4">数据概览</h2>
      
      <!-- 简化数据卡片 -->
      <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
        <div class="bg-white p-4 rounded-lg shadow-sm">
          <p class="text-sm text-gray-500">总访问量</p >
          <div class="flex justify-between items-center">
            <span class="text-2xl font-bold">24,589</span>
            <span class="text-green-500 text-sm"><i class="fa fa-arrow-up"></i> 12.5%</span>
          </div>
        </div>
        <div class="bg-white p-4 rounded-lg shadow-sm">
          <p class="text-sm text-gray-500">活跃用户</p >
          <div class="flex justify-between items-center">
            <span class="text-2xl font-bold">8,742</span>
            <span class="text-green-500 text-sm"><i class="fa fa-arrow-up"></i> 8.7%</span>
          </div>
        </div>
      </div>
      
      <!-- 简化图表 -->
      <div class="bg-white p-4 rounded-lg shadow-sm mb-6">
        <h3 class="font-medium mb-3">用户增长趋势</h3>
        <div class="h-64">
          <canvas id="line-chart"></canvas>
        </div>
      </div>
    </main>
  </div>

  <script>
    // DOM元素
    const loginPage = document.getElementById('login-page');
    const mainPage = document.getElementById('main-page');
    const loginForm = document.getElementById('login-form');
    const logoutBtn = document.getElementById('logout-btn');
    
    // 登录验证
    loginForm.addEventListener('submit', (e) => {
      e.preventDefault();
      const username = document.getElementById('username').value;
      const password = document.getElementById('password').value;
      
      if (username === 'admin' && password === '123456') {
        // 1秒后跳转
        setTimeout(() => {
          loginPage.classList.add('hidden');
          mainPage.classList.remove('hidden');
          initChart(); // 初始化图表
        }, 1000);
      } else {
        alert('账号或密码错误，测试账号：admin，密码：123456');
      }
    });
    
    // 退出登录
    logoutBtn.addEventListener('click', () => {
      mainPage.classList.add('hidden');
      loginPage.classList.remove('hidden');
      loginForm.reset();
    });
    
    // 初始化图表（简化）
    function initChart() {
      const ctx = document.getElementById('line-chart').getContext('2d');
      new Chart(ctx, {
        type: 'line',
        data: {
          labels: ['1月', '2月', '3月', '4月', '5月', '6月'],
          datasets: [{
            label: '用户数量',
            data: [1200, 1900, 3000, 5000, 4500, 6000],
            borderColor: '#165DFF',
            fill: true,
            backgroundColor: 'rgba(22, 93, 255, 0.1)'
          }]
        },
        options: {
          responsive: true,
          maintainAspectRatio: false
        }
      });
    }
  </script>
</body>
</html>